$(function(){
    var basePath = [[@{/}]];

    $("#form-submit-forget-one").on("click", function () {
        var phone = $.trim($("#phone").val());
        var imgCode = $.trim($("#imgCode").val());

        if (phone.length == 0) {
            $(".error_msg").html("请输入手机号");
            return;
        }

        if (imgCode.length == 0) {
            $(".error_msg").html("请输入验证码");
            return;
        }

        $.ajax({
            url: basePath + '/forget/securityVerification',
            data: $("#form-data-forget-one").serialize(),
            dataType: "json",
            type: 'POST',
            success: function(data) {
                if (data.success) {
                    $("#hiddenPhone").val(data.data.phone);
                    $("#form-phone").submit();
                } else {
                    $("#imgCode").attr("src", basePath + "validate/imageCode?t=" + new Date().getTime())
                    $(".error_msg").html(data.message);
                }
            }
        });
    })
});

// 更换图片验证码
function changeCode(){
    $("#imgValidateCode").attr("src", basePath + "validate/imageCode?t=" + new Date().getTime());
}


